from pyglet.event import EventDispatcher

'''
定义系统中的消息发送器
'''

class FJEventDispatcher(EventDispatcher):
    __instance = None

    def __new__(cls, *args, **kwargs):
        if not cls.__instance:
            cls.__instance = super(FJEventDispatcher, cls).__new__(cls)
        return cls.__instance

## 注册事件
FJEventDispatcher.register_event_type('on_bullet_reusable')
FJEventDispatcher.register_event_type('on_enemy_reusable')
FJEventDispatcher.register_event_type('on_game_over')
FJEventDispatcher.register_event_type('on_game_start')
# FJEventDispatcher.register_event_type('on_game_restart')
FJEventDispatcher.register_event_type('on_game_pause')
FJEventDispatcher.register_event_type('on_game_resume')

## 实例化一个对象
fj_event_dispatcher = FJEventDispatcher()